package org.vectrics.user.web.struts;

import org.apache.log4j.Category;
import org.vectrics.common.html.BorderTable;
import org.vectrics.common.html.Cell;
import org.vectrics.common.html.Row;
import org.vectrics.common.html.TextHelper;
import org.vectrics.user.Person;


public abstract class UserManagerTag extends UserGroupManagerTag {
	private static Category log = Category.getInstance(UserManagerTag.class);

    
    
    public String getDescription() {
        log.debug("getDescription() called.");
        return("User List");
    }
    
    public UserManagerTag() {
    	//
    }

    
    protected void makeHeaderCells(Row row) {
        log.debug("makeHeaderCells() called.");
        
        Cell cell = row.addCell();
        cell.addElement(TextHelper.getFont("subFont", "<b>Last Name</b>"));

        cell = row.addCell();
        cell.addElement(TextHelper.getFont("subFont", "<b>First Name</b>"));

        cell = row.addCell();
        cell.addElement(TextHelper.getFont("subFont", "<b>Home City</b>"));

        cell = row.addCell();
        cell.addElement(TextHelper.getFont("subFont", "<b>Options</b>"));
    }
    

    protected void makeObjectRow(Row row, Person user) {
        Cell cell = row.addCell();
        cell.addElement(TextHelper.getFont("subFont", user.getLastName()));

        cell = row.addCell();
        cell.addElement(TextHelper.getFont("subFont", user.getFirstName()));

        cell = row.addCell();
        if (user.getContactInfo() != null) {
            if (user.getContactInfo().getHomeAddress() != null)
                cell.addElement(TextHelper.getFont("subFont", user.getContactInfo().getHomeAddress().getCity()));
        }
        
    }

    protected void setTableProperties(BorderTable table) {
        table.setWidth(500);
    }
 
}